package com.example.user.config;

import java.util.concurrent.Executor;

/**
 * Author:汪彬彬
 * date:2024/11/20 10:07
 */
public class ThreadPoolUtil {

    public static CustomThreadPoolExecutor getExecutor() {
        CustomThreadPoolExecutor executor = new CustomThreadPoolExecutor();
        // 核心线程数
        executor.setCorePoolSize(20);
        // 最大线程数
        executor.setMaxPoolSize(40);
        // 队列大小
        executor.setQueueCapacity(100);
        // 线程前缀名
        executor.setThreadNamePrefix("ImageProcessor-");
        // 初始化线程池
        executor.initialize();
        return executor;
    }
}
